package main

import (
	"strings"

	"golang.org/x/tour/wc"
)

func WordCount(s string) map[string]int {

	//先将每个单词截取出来 作为key
	//映射到了映射值就+1
	m := strings.Split(s, " ")
	l := len(m)
	n := make(map[string]int)
	for i := 0; i < l; i++ {
		n[m[i]]++
	}

	return n
}

func main() {
	wc.Test(WordCount)
}
